<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>角色权限分配 </title>
    <#include "/pages/include/head.ftl" />
	<#import "/pages/import/images.ftl" as img />
	
	<!--tree组件样式-->
	<#include "/pages/include/tree-css.ftl" />
	
   <style type="text/css">
      .tree{height:490px;width:255px;}
   </style>
</head>
<body>
<div class="popwindow-title">角色权限分配 </div>
<div class="popwindow-container">

  <div class="popwindow-container">
    <!--搜索栏-->
    <div class="list-container grid-border" style=" height:415px;">
      <!--结束-->
      <!--tree-->
<@s.component id="tree" template="components/tree.ftl" >
	  <@s.param name="targetId" value="%{'tree'}" />
	  <@s.param name="treeModelBean" value="%{'functionEntityTreeModel'}" />
	  <@s.param name="parentProperty" value="%{'parent.id'}" />
	  <@s.param name="idProperty" value="%{'id'}" />
	  <@s.param name="textProperty" value="%{'alias'}" />
	  <@s.param name="withCheckBox" value="1" />
</@s.component>

<div id="tree" class="tree"></div>
      <!--结束-->
    </div>
  </div>
</div>
<div class="popwindow-btn-area">
  <div class="btn-order" id="btn_confirm">
    <ul>
      <li class="left-normal" id="btn1_11"></li>
      <li class="middle-normal" id="btn1_12" onmouseover="btn_change_over(1)" onmouseout="btn_change_out(1)" onblur="btn_change(1)"><img src="${contextPath}/images/ico16/ico-ok.gif" alt="" />确 定</li>
      <li class="right-normal" id="btn1_13"></li>
    </ul>
  </div>
  <div class="btn-order" onclick="windowClose()">
    <ul>
      <li class="left-normal" id="btn1_31"></li>
      <li class="middle-normal" id="btn1_32" onmouseover="btn_change_over(3)" onmouseout="btn_change_out(3)" onblur="btn_change(3)"><img src="${contextPath}/images/ico16/ico-cancel.gif" alt="" />取 消</li>
      <li class="right-normal" id="btn1_33"></li>
    </ul>
  </div>
</div>

<input type="hidden" name="role.id" id="roleId" value="${Request.id}"/>
<script>
  /** var ckValues;
   $(function(){
    $("#tree").subscribe("tree-nodeChecked",function(event, data){
        ckValues = data.checkedValues;
        alert('--'+data.checkedValues);
    });
  });*/
  $("#btn_confirm").click(function(){
      var values = $("#tree").data("checkedValues");
      if(values.length==0){
            alert('请至少选择一个权限再提交');
            return;
      }

      $.ajax({                                                
	      type: "POST",                                     
	      url: "addPermissions.action",                                    
	      data: "id="+$("#roleId").val()+"&funids="+values,   
	      success: function(msg){
    	    windowClose();	  	   
	      } 
	  }); 
	});
   </script>
 </body>
</html>
